import java.util.ArrayList;
import java.util.Scanner;


public class ApplyViscosity implements ApplyForce {

    
    
    private double scale=0.01 ;
    private double preScale=0.01;
    
    
    
   
    public Force getForce(Mass m){
        Force velocity=m.getVelocity();
        return new Force(-velocity.getDirection(),scale*velocity.getMagnitude());
    }
    
    public void turnOffForce(){
       
        scale=0;
    }
    
    public void turnOnForce(){
        
        scale=preScale;
    }
    
    public void toggle () {
        if ( scale==0){
            turnOnForce();
        }else{
            turnOffForce();
        }
        
    }
  
    @Override
   public final void build(Scanner line, Simulation sim) {
    
   
    scale = line.nextDouble();
    preScale=scale;
   
    }
    

}
